﻿//-----------------------------------------------------------------------------------------------------------
// Wbfs Engine (WBFSe) Project by Omega Frost 
// http://wbfse.codeplex.com/
//
// WBFSe is Licensed under the terms of the 
// Microsoft Reciprocal License (Ms-RL)
//-----------------------------------------------------------------------------------------------------------
using System;
using System.IO;
using WBFSe.Attributes;
using WBFSe.Builders;

namespace WBFSe.IO
{
    /// <summary>
    /// Representation of a game
    /// </summary>
    public interface IWbfsFileInfo : IGameInfo, IContainerInfo
    {
        /// <summary>
        /// Indicates that the file
        /// is being created by engine
        /// and may be deleted on failure
        /// </summary>
        Boolean Temporary { get; }

        /// <summary>
        /// Number of open streams
        /// </summary>
        Int32 ActiveStreams { get; }

        /// <summary>
        /// Generates extended information for the game
        /// </summary>
        /// <param name="flags">Build flags</param>
        /// <returns>Disc's extended information</returns>
        /// <exception cref="System.NotImplementedException">Game type not supported</exception>
        /// <exception cref="System.FormatException">The disc inside the container is corrupted</exception>
        /// <exception cref="System.NotSupportedException">The file is temporary</exception>
        IDiscExtendedInfo BuildExtendedInfo(BuildFlags flags);

        /// <summary>
        /// Creates a stream with desired access and share
        /// </summary>
        /// <param name="access">Access for all files of the container</param>
        /// <param name="share">Share for all files of the container</param>
        /// <returns>Stream on success</returns>
        /// <exception cref="System.Exception">On operation failure</exception>
        IWbfsStream Open(FileAccess access, FileShare share);

        /// <summary>
        /// Changes the game data
        /// </summary>
        /// <param name="name">New name</param>
        /// <param name="code">New code</param>
        /// <exception cref="System.NotSupportedException">The file is temporary</exception>
        void ChangeDiscHeader(String name, String code);

        /// <summary>
        /// Extracts files from the disc
        /// </summary>
        /// <param name="partition">Partition index</param>
        /// <param name="path">Full path of the file</param>
        /// <param name="output">Stream for data output</param>
        /// <exception cref="System.NotSupportedException">The file is temporary</exception>
        void ExtractFile(int partition, String path, Stream output);
    }
}
